package com.framework.Module.base.notice;

import com.framework.ACore.ModuleFields;
import com.framework.ACore.ModuleTodo;
import com.framework.Table.Table;
import com.framerock.baselib.CDate;
import com.framerock.baselib.Rock;


public class Tablenotice extends Table {

  
    protected void initTable() {
        this.tablename   = "notice";
        this.tablenamesm = "通知公告";

        this.flowsetMap  = Rock.getMap(new String[]{
                "type", "行政",
                "sort", "30",
                "isxt", "2",
                "summary", "[{typename}]{title}",
                "imgurl","https://cloudplat-1251238447.cos.ap-nanjing.myqcloud.com/rockfile/upload/clouddrive/2024-09/07_17410385_s.png",
                "istj","1"
        });
        this.addfields("fengmian", "varchar(200)", "", "封面", new String[]{
                "fieldstype","uploadimg"
        });
        this.addfields("title", "varchar(100)", "", "标题", new String[]{
                "isbt","1",
                "isss","1",
                "isalign","1"
        });
        this.addfields("typename", "varchar(50)", "", "类型名称@noticetype", new String[]{
                "isbt","1",
                "isss","1",
                "fieldstype","rockcombo"
        });
        this.addfields("recename", "varchar(1000)", "", "发送给@receid@全部人员可选顶级部门", new String[]{
                "isss","1",
                "isbt","1",
                "fieldstype","changedeptusercheck",
        });
        this.addfields("receid", "varchar(1000)", "", "发送给人员ID", new String[]{
                "islu","0",
                "islb","0",
        });
        this.addfields("laiyuan", "varchar(100)", "", "来源", new String[]{
                "isbt","1",
                "isss","1",
                "devval","{deptname}"
        });
        this.addfields("indate", "date", null, "日期", new String[]{
                "isbt","1",
                "isss","1",
                "ispx","1",
                "devval","{date}"
        });
        this.addfields("optname", "varchar(100)", "", "操作人", new String[]{
                "islu","0",
                "isss","1",
        });
        this.addfields("cid", "int(11)", "0", "对应单位", new String[]{
                "islu","0",
                "notelement","1"
        });
        this.addfields("aid", "int(11)", "0", "发布人ID", new String[]{
                "islu","0",
                "islb","0",
                "notelement","1"
        });
        this.addfields("content", "text", null, "内容", new String[]{
                "islb","0",
                "fieldstype","htmlediter"
        });
        this.addfields("filecont", "varchar(200)", "", "相关文件", new String[]{
                "islb","0",
                "fieldstype","uploadfile"
        });
        this.addfields("sort", "int(11)", "0", "排序", new String[]{
                "ispx","1",
                "iseditlx","2"
        });
        this.addfields("optdt", "datetime", null, "操作时间", new String[]{
                "islu","0",
                "islb","0",
        });
        this.addfields("startdt", "datetime", null, "展示开始@@不设置长期展示", new String[]{
                "islb","0",
        });
        this.addfields("enddt", "datetime", null, "展示截止@@不设置长期展示", new String[]{
                "islb","0",
        });

        addModuleFields(ModuleFields.get()
                .setName("状态")
                .setFields("status")
                .setType("tinyint(1)")
                .setDev("1")
                .setIsss(0)
                .setIslu(0)
                .setIslb(1)
                .setData("0|未启用|blue,1|启用|green,2|未通过|red")
        );

        this.addfields("cid", "KEY", "`cid`", "单位ID");


        //{receid,字段},{join,字段}
        this.addWhere("与我相关", "my", "`status`=1 AND {receidnot}", "wtype=1");
        this.addWhere("我创建的", "mycj", "`aid`={aid}", "wtype=2");
        this.addWhere("通知接收人", "mytodo", "`status`=1", "islb=0");
        this.addWhere("自己创建可删", "mydel", "`aid`={aid}", "islb=0,wtype=3");
        this.addWhere("所有记录", "all", "1=1", "pnum=all");

        //添加单据通知设置
        this.addFlowTodo(ModuleTodo.get("todo")
                .setName("{typename}")
                .setSummary("{title}")
                .setWherelx("mytodo")
                .setWherena("通知接收人")
                .setActtype("turn,edit,finish")
                .setTofields("receid")
        );

    }

}
